package com.eastday.model;

import java.io.IOException;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;

/**
 * 
 * @author dingxs
 *
 */
public class SysConfigModel {

	private String dbtype;
	private String hostip;
	private String hostport;
	private String dbname;
	private String username;
	private String password;
	private String divid;
	private int interval;
	private String temppath;
	private int exportPageSize;
	private String exportPath;
	private String exportFilename;
	private String logfile;
	
	public SysConfigModel()
	{
		
	}

	public String getDbtype() {
		return dbtype;
	}

	public void setDbtype(String dbtype) {
		this.dbtype = dbtype;
	}

	public String getHostip() {
		return hostip;
	}

	public void setHostip(String hostip) {
		this.hostip = hostip;
	}

	public String getHostport() {
		return hostport;
	}

	public void setHostport(String hostport) {
		this.hostport = hostport;
	}

	public String getDbname() {
		return dbname;
	}

	public void setDbname(String dbname) {
		this.dbname = dbname;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getDivid() {
		return divid;
	}

	public void setDivid(String divid) {
		this.divid = divid;
	}

	public int getInterval() {
		return interval;
	}

	public void setInterval(int interval) {
		this.interval = interval;
	}

	public String getTemppath() {
		return temppath;
	}

	public void setTemppath(String temppath) {
		this.temppath = temppath;
	}

	public int getExportPageSize() {
		return exportPageSize;
	}

	public void setExportPageSize(int exportPageSize) {
		this.exportPageSize = exportPageSize;
	}

	public String getExportPath() {
		return exportPath;
	}

	public void setExportPath(String exportPath) {
		this.exportPath = exportPath;
	}

	public String getExportFilename() {
		return exportFilename;
	}

	public void setExportFilename(String exportFilename) {
		this.exportFilename = exportFilename;
	}
	
	
	
	public String getLogfile() {
		return logfile;
	}

	public void setLogfile(String logfile) {
		this.logfile = logfile;
	}

	public void buildSysConfig(Document document) throws JDOMException,IOException{
		
		Element root           = document.getRootElement();
		Element dbConfig       = root.getChild("DbConfig");
		Element dbtype         = dbConfig.getChild("dbtype");
		Element hostip         = dbConfig.getChild("hostip");
		Element hostport       = dbConfig.getChild("hostport");
		Element dbname         = dbConfig.getChild("dbname");
		Element username       = dbConfig.getChild("username");
		Element password       = dbConfig.getChild("password");
		Element htmlConfig     = root.getChild("HtmlConfig");
		Element divid          = htmlConfig.getChild("divid");
		Element sysConfig      = root.getChild("SysConfig");
		Element interval       = sysConfig.getChild("interval");
		Element temppath       = sysConfig.getChild("temppath");
		Element exportPageSize = sysConfig.getChild("exportpagesize");
		Element exportPath     = sysConfig.getChild("exportPath");
		Element exportFilename = sysConfig.getChild("exportFilename");
		Element logfile        = sysConfig.getChild("logfile");
		
		this.setDbtype(dbtype.getText());
		this.setHostip(hostip.getText());
		this.setHostport(hostport.getText());
		this.setDbname(dbname.getText());
		this.setUsername(username.getText());
		this.setPassword(password.getText());
		this.setDivid(divid.getText());
		this.setInterval(Integer.parseInt(interval.getText()));
		this.setTemppath(temppath.getText());
		this.setExportPageSize(Integer.parseInt(exportPageSize.getText()));
		this.setExportPath(exportPath.getText());
		this.setExportFilename(exportFilename.getText());
		this.setLogfile(logfile.getText());
		
	}
	
	
	
}
